﻿<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages.Administration, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#"  MasterPageFile="~/_admin/admin.master"  Inherits="Havivi.PropertyBagSettings.ImportPropertyBag, Havivi.PropertyBagSettings, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register TagPrefix="PropertyBagSettings" Namespace="Havivi.PropertyBagSettings"
    Assembly="Havivi.PropertyBagSettings, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="Microsoft.SharePoint.Administration" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Import Namespace="System.Xml" %>
<%@ Register TagPrefix="wssuc" TagName="LinkSection" Src="~/_controltemplates/LinkSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" Src="~/_controltemplates/Toolbar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="~/_controltemplates/Toolbarbutton.ascx" %>

<%--
Property Bag Settings 
By Alon Havivi(havivi@gmail.com, http://havivi.blogspot.com/) 
For full source code and Terms Of Use,
visit http://www.codeplex.com/pbs
--%>


<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script>
        var checkBoxGroupName = "propertiesCheckboxes";
        function checkBoxClick() {
            var checkBoxHidden = (document.getElementById("<%= HiddenPropertiesSelections.ClientID %>"));
            checkBoxHidden.value = "";
            var selectAllCheckBox = document.getElementById("selectAllCheckBox");
            if (selectAllCheckBox != null)
                selectAllCheckBox.checked = false;
            var i;
            for (i = 0; i < theForm.length; i++) {
                curGroup = theForm[i].group;
                if (checkBoxGroupName == curGroup && theForm[i].checked == true)
                    checkBoxHidden.value += theForm[i].name + "#";
            }
        }
        var allchecked = false;

        function selectAllCheckBoxClick(selectAllCheckBox) {
            allchecked = !allchecked;
            for (i = 0; i < theForm.length; i++) {
                curGroup = theForm[i].group;
                if (checkBoxGroupName == curGroup)
                    theForm[i].checked = allchecked;
            }
            checkBoxClick();
        }
        function _spBodyOnLoad() {
            var checkBoxHidden = (document.getElementById("<%= HiddenPropertiesSelections.ClientID %>"));
            checkBoxHidden.value = "";
        }

    </script>
    <input type="hidden" id="HiddenPropertiesSelections" runat="server" />
    <h3>
        <asp:Label runat="server" ID="txtImportHeader"></asp:Label>
    </h3>
    <asp:Label runat="server" ID="lblDesc" Text="Paste the import file url into the textbox to import the properties:"></asp:Label>
    <br />
    <asp:TextBox runat="server" ID="txtUrl" CssClass="ms-input"  Width="320"></asp:TextBox>
    <asp:Button runat="server" ID="btnLoadProperties" Text="Load Properties" OnClick="btnLoadProperties_Click"
        CssClass="ms-ButtonHeightWidth" /><br /><br />
    <asp:CheckBox runat="server" ID="cbOverwrite" Text="Overwrite existing properties" /><br />
    If you select 'Overwrite existing properties', then the existing property is overwritten.  <br /><br />
    <asp:Label runat="server" ID="lblMsg" ForeColor="Red" CssClass="ms-descriptiontext"></asp:Label>
    <br />
    <wssuc:ToolBar id="Toolbar" runat="server" CssClass="ms-toolbar">
        <template_buttons>
            <wssuc:ToolBarButton runat="server"
                    id="btnImport"
                    Text="Import selected properties"
                    ToolTip="Click here to start the import."
                    ImageUrl="/_layouts/images/IMPITEM.GIF"
                    OnClick="btnImport_Click"
                    Padding="2px"
                    AccessKey="A" />
        </template_buttons>
    </wssuc:ToolBar>
    <table width="100%" class="propertysheet" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td class="ms-descriptionText">
            </td>
            <SharePoint:SPGridView ID="grdProperties" runat="server" Width="100%" AllowSorting="True"
                AutoGenerateColumns="false">
                <AlternatingRowStyle CssClass="ms-alternating" />
                <Columns>
                    <asp:BoundField DataField="ID" DataFormatString='&lt;input type="checkbox" group="propertiesCheckboxes" name="{0}" onclick="checkBoxClick();">'
                        HtmlEncode="false" HeaderText='<img id="selectAllCheckBox" src="/_layouts/images/unchecka.gif" onclick="selectAllCheckBoxClick(this);" />'
                        ItemStyle-Width="1" />
                    <asp:BoundField DataField="Key" HeaderText="Key" />
                    <asp:BoundField DataField="Value" HeaderText="Value" />
                </Columns>
            </SharePoint:SPGridView>
        </tr>
        <tr>
            <td height="10px" class="ms-descriptiontext" colspan="2">
                <img src="/_layouts/images/blank.gif" width="1" height="10" alt="">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <colgroup>
                        <col width="99%" />
                        <col width="1%" />
                    </colgroup>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button CssClass="ms-ButtonHeightWidth" name="BtnCancel" ID="BtnCancel" OnClick="btnCancel_Click"
                                Text="Close" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Import Properties
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    Import Properties
</asp:Content>
